home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / SYS / s / CmdShell.bed < prev    next >
Text File  |  1996-09-26  |  1KB  |  81 lines

  1. /*
  2. ** $VER: CmdShell.bed 1.0 (02.01.96)
  3. **
  4. ** Run the BED command shell
  5. */
  6.  
  7. OPTIONS RESULTS
  8. OPTIONS FAILAT 100
  9. OPTIONS PROMPT "BED> "
  10.  
  11. SAY
  12. SAY ' Enter a BED command or:'
  13. SAY ' - Help <command>'
  14. SAY ' - GetTemplate <command>'
  15. SAY
  16.  
  17. DO FOREVER
  18.     PARSE PULL cmdString
  19.  
  20.     SELECT
  21.         WHEN (cmdString = "") | (UPPER(cmdString) = "Q") | (UPPER(cmdString) = "QUIT") THEN DO
  22.             LEAVE
  23.         END
  24.  
  25.         WHEN (cmdString = "?") THEN DO
  26.             SAY 'Enter "Help <command>" to obtain a command''s help'
  27.             SAY 'Enter "GetTemplate <command>" to obtain the command''s template'
  28.             SAY 'Enter CTRL-\ to close this window.'
  29.         END;
  30.  
  31.         OTHERWISE DO
  32.             CALL HandleCmd(cmdString)
  33.         END;
  34.     END
  35. END
  36.  
  37. RETURN
  38.  
  39.  
  40. HandleCmd: PROCEDURE
  41. PARSE ARG cmdString
  42.  
  43.     cmdString
  44.  
  45.     IF RC = 0 THEN DO
  46.         IF symbol('RESULT') == "VAR" THEN DO
  47.             SAY RESULT
  48.         END
  49.         RETURN
  50.     END;
  51.  
  52.     IF BED.LASTERROR = 29 THEN DO
  53.  
  54.         ADDRESS REXX cmdString
  55.  
  56.         IF RC > 0 THEN DO
  57.             ADDRESS COMMAND cmdString
  58.         END
  59.     END
  60.  
  61.     IF RC > 0 THEN DO
  62.  
  63.         last        = BED.LASTERROR
  64.         special = BED.SPECIALERROR
  65.  
  66.         GetErrorInfo last
  67.         SAY '*** General Error #'last'; 'RESULT
  68.  
  69.         IF special ~= 0 THEN DO
  70.             IF last = 36 THEN
  71.                 msg = ERRORTEXT(special)
  72.             ELSE DO
  73.                 GetErrorInfo last special
  74.                 msg = RESULT
  75.             END
  76.  
  77.             SAY '*** Special Error #'special'; 'msg
  78.         END
  79.     END
  80. RETURN
  81.